//
//  YFTextField.m
//  QuanJieShopProject
//
//  Created by apple on 2018/5/9.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "YFTextField.h"

@implementation YFTextField

- (CGRect)leftViewRectForBounds:(CGRect)bounds
{
    CGRect iconRect = [super leftViewRectForBounds:bounds];
    iconRect.origin.x += 8; //像右边偏移
    return iconRect;
}

// 控制显示文本的位置
- (CGRect)textRectForBounds:(CGRect)bounds
{
//    CGRect textBounds = CGRectMake(bounds.origin.x + 10 + self.leftView.frame.size.width + 10, bounds.origin.y, bounds.size.width - self.leftView.frame.size.width * 2 - 40, bounds.size.height);
    CGRect textBounds = CGRectMake(CGRectGetMaxX(self.leftView.frame) + 8, bounds.origin.y, bounds.size.width, bounds.size.height);

    return textBounds;
}

// 控制编辑文本的位置
-(CGRect)editingRectForBounds:(CGRect)bounds
{
    CGRect textBounds = CGRectMake(CGRectGetMaxX(self.leftView.frame) + 8, bounds.origin.y, bounds.size.width, bounds.size.height);

    return textBounds;
}

@end
